package com.minelx.serverandclient.stream.data;

import java.io.ByteArrayOutputStream;

public class BytesOutput {

	private final ByteArrayOutputStream totalBytes;

	public BytesOutput() {
		totalBytes = new ByteArrayOutputStream();
	}

	public BytesOutput write(byte[] bytes, int off, int len) {
		totalBytes.write(bytes, off, len);
		return this;
	}

	public byte[] take() {
		byte[] result = totalBytes.toByteArray();
		totalBytes.reset();
		return result;
	}
}
